package com.boe.csb.web.converter;

import com.boe.csb.core.common.exception.CSBErrorCode;
import com.boe.csb.core.entity.ResultInfo;
import com.boe.csb.web.model.ResultModel;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.databind.util.Converter;

public class ResultInfoToModule {
	
	public static <T> ResultModel<T> getModule(ResultInfo<T> resultInfo){
		
		if(resultInfo.getErrorCode().equals(CSBErrorCode.SUCCESS)){
			return ResultModel.success(resultInfo.getResult());
		}
		
		return ResultModel.fail(resultInfo.getErrorCode(), null);
	}

}
